<?php
	require_once( "functions/inc_systemFunctions.php" );
	if( !empty( $_POST['quickAccessCode'] ) ){
		# get position of that product
		$sql = "SELECT    product.tbl_shelfs_id AS tbl_shelfs_id, 
		                  product.slotInShelf AS slotInShelf, 
		                  shelfs.shelf_floor AS shelfs_floor, 
		                  shelfs.shelf_corridor AS shelfs_corridor,
		                  shelfs.shelf_ID AS shelfs_shelf
		        FROM      product 
		        JOIN      shelfs 
		        ON        product.tbl_shelfs_id = shelfs.shelf_ID 
		        WHERE     product.quickAccessCode = '" . $_POST['quickAccessCode'] . "' ";
		$res = mysql_query( $sql );
		if( !$res ){ 
			header( "Location: " . $_SERVER['HTTP_REFERER'] );
		} else {
			$row = mysql_fetch_array( $res );
			if( mysql_num_rows( $res ) > 0 ){
				$_SESSION["current_position"]["floor"]    = $row["shelfs_floor"];
    			$_SESSION["current_position"]["corridor"] = $row["shelfs_corridor"];
    			$_SESSION["current_position"]["shelf"]    = $row["shelfs_shelf"];
			}
			header( "Location: " . $_SERVER['HTTP_REFERER'] );
		}

	} else {
		header( "Location: " . $_SERVER['HTTP_REFERER'] );
	}
?>